package com.pan.kang.security;


import cn.hutool.core.collection.CollectionUtil;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

import java.util.List;

public class PermissionMatcher {

    private static final PathMatcher pathMatcher = new AntPathMatcher();

    public static Boolean checkPermission(List<String> urls, String curUrl) {
        if (CollectionUtil.isEmpty(urls)) {
            return false;
        }
        for (String url : urls) {
            if (pathMatcher.match(url, curUrl)) {
                return true;
            }
        }
        return false;
    }
}
